home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / OWL / BLRPLT / COLORTST.PAS < prev    next >
Pascal/Delphi Source File  |  1994-04-09  |  2KB  |  87 lines

  1. {Test program to test the dialog in colors.pas}
  2.  
  3. program testdlg;
  4.  
  5. {$R COLOR.RES}
  6. uses
  7.   Color,  WinTypes, WinProcs, WinDos,
  8.   {$ifdef VER70}
  9.   Objects, OWindows, ODialogs, Strings, OStdDlgs, OStdWnds;
  10.   {$else}
  11.   WObjects, Strings, StdDlgs, StdWnds;
  12.   {$endif}
  13.  
  14. const
  15.   cm_Dialog = 102;
  16.  
  17. type
  18.   TMyApp = object(TApplication)
  19.     procedure InitInstance; virtual;
  20.     procedure InitMainWindow; virtual;
  21.   end;
  22.  
  23.   PMyWindow = ^TMyWindow;
  24.   TMyWindow = object(TWindow)
  25.  
  26.     constructor Init(ATitle : PChar);
  27.     destructor Done; virtual;
  28.     Procedure cmDialog(var Msg : TMessage); virtual cm_First + cm_Dialog;
  29.   end;
  30.  
  31. {-------TMyWindow.Init}
  32. constructor TMyWindow.Init(ATitle : PChar);
  33. var
  34.   AMenu : hMenu;
  35. begin
  36.   TWindow.Init(Nil, ATitle);
  37.  
  38.   AMenu := CreateMenu;     {make a menu}
  39.   AppendMenu(AMenu, mf_String, cm_Exit, 'E&xit');
  40.   AppendMenu(AMenu, mf_String, cm_Dialog, '&Dialog');
  41.   with Attr do
  42.     begin
  43.     Style := ws_OverlappedWindow;
  44.     Menu := AMenu;
  45.     end;
  46.  
  47. end;
  48.  
  49. {----------------TMyWindow.Done}
  50. destructor TMyWindow.Done;
  51. begin
  52.   TWindow.Done;
  53. end;
  54.  
  55. {-----------------TMyWindow.cmDialog}
  56. Procedure TMyWindow.cmDialog(var Msg : TMessage);
  57. var
  58.   Dlg : PColorDialog;
  59. begin
  60.   Dlg := New(PColorDialog, Init(@Self));
  61.   if Application^.ExecDialog(Dlg) = idOK then
  62.       begin
  63.         {Do something with results}
  64.       end;
  65. end;
  66.  
  67. {------TMyApp.InitMainWindow}
  68. procedure TMyApp.InitMainWindow;
  69. begin
  70.   MainWindow := New(PMyWindow, Init('Test The Dialog'));
  71. end;
  72.  
  73. {------TMyApp.InitInstance}
  74. procedure TMyApp.InitInstance;
  75. begin
  76.   TApplication.InitInstance;
  77.   hAccTable := 0;
  78. end;
  79.  
  80. var
  81.   App : TMyApp;
  82. begin
  83.   App.Init('MyWindow');
  84.   App.Run;
  85.   App.Done;
  86. end.
  87.